
package com.demo.bean;

import java.lang.reflect.Proxy;
//生成代理对象的工厂
public class ProxyFactory {
	
	public static Object getProxy(Object target){
		
		LogHandler handler = new LogHandler(target);
		Object obj = null;
		ClassLoader classLoader = target.getClass().getClassLoader();
		Class[] classes = target.getClass().getInterfaces();
		obj = Proxy.newProxyInstance(classLoader, classes, handler);
		
		return obj;
	}
	
}
